package cn.kgc.controller;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 阿里支付的配置文件
 *
 * @author 韩宏伟
 */
public class AlipayConfig {

    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092500590069";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQCxIonMV85OF4SxpzU01Zt5q6AZz1/JnVZC9wFHo8f7qoDchMxBsajrtsrcsDSqX5tI0GJfvZpi2sWgFllHQ2vabg2zMn+QqWc+tw2iVmOg1XlsQ5EKknm/XgFoSKmsdL5E7zo4nnRkvyVj788Pq6fT8EVYEwLrtz8v1dk1Wpur5xjzoskfTiv1OstiVG0x/DjBa6AiUacKETDDxcKyE8wdyVRgIGx0Biwex/jpqeEC7iAV4VqABIzojQPlrK+a97oZwo6TQ9Yx5Nbsg3naojVmEJg3c82uyXtYzNAz9hSVBmD9CDeG42VFqjV+g5e9euTyyCjktlY8leDe0TrE5EFZAgMBAAECggEAeidyVdv7prjrRkQkGhJwzKBBoWr0CKqbEUUbudbFk9VKVkiyP1+QOTVugnB1cUTLZpRmMtYjQKbUAIlI+i8RkqmwgvKBLDbWv1Ynbdsbi4+L09BolpzantDqMYtij05W5F0BjogfhlaXJ2r6JTlgXHTmrU03B2zwg0F7MCMTFaD7Fn3gtcXZk7odpA9awJg+hE0WcQvH/Pj4/nJ71Nu6fqWcwVxhQNqmOO8RLBKeN6EA6om61SCApLMXPM1CUwvaQ0OqAQRVgXpNNr52xj2pgezZOJbTO9bwbNm2QE9r3UlJ6cAMV9aefaqoLFaYT9ruPxhmZdwpgTT5OOFSvrC98QKBgQDpLbN/mQPkXrTio71tMlUtTZwOSKfVLHXK6sz5DLaSkErChAaZRWNI/SCxGxpQjmviAnJmjt23VWvKwQgSLXgCBGpq9dOAc264Bsa6appE/A0UBwfPIYwr0iyZOtRLOygOrQHuehm2eQrCZxUBHGd8s4izGypfb/P9fGuYjekVbQKBgQDCeKl0vthviQsu8/nvOhAw+b8X9tJ3iDee4SMZR23ezVkTQCHmGBZKyR+v1O2/1I1XbSuBZgFU+03hme/75s4z1OVTt+l7H8JJAvSvmJufDcd6qjdfo/VMYLDiYy0Ovaxd1t1NpPXrYi174IAgjx/HDoON1izP9md5nt3Pe++kHQJ/OzRfXwZ69oEVbHYmopMlDVunQ/kuo/Gl9t+nK5UOxifc04ayJjh3/RBIPK+k/s8qlTgJ1ABySxplRBW+9t6Ume6FFqNUEEk+03rk+nAWu21D5NHkKbNa48V5jW5ieLeMdC15UBOwc6RIFxQVQTL1E7SCAPfkylainLn6l8FwbQKBgAzlZ4dgaIXs9prkfvyIQy6cQTnbmlVm6RlWILe6buTJhVCrfhP+IOxQrhNA8Ys5Ey5rBOmN1CTIjX+ab7mqsp3pTlPg7FDH6GBjG8rROfCwPzw5MXbcLpYkC1bX8NL7bQTEDOTrPYugdRez6Ys/MoJGyh6Lx2j7FB2SlW7+7wNZAoGBALMi9YaU1os0gAjJ3t9PXLbP49xQCMP2Moudc391bRT29yafFiocqN4lXduR5nvFCfiCgo66cfPoNoctwKL5eaXduf8UQlcw77axQC67Wd3xLBS4hzMaS3oTLTOjx9P8NmkhcqDgUcSuX02twh/HVSpMnjU0o4Skm0cUgO4bdLXt";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuZf8Y2I30bnzMQyMkZsOmLVZxEx2XfSiZWjUp4EX8hw46W4/752TwZTD6DAzWTgske71gTnNpnV9cs71G6KuoMKtBa0PB7QRFQJDLo28NE56xnt7meekrGvts2oHJTd45aLAdRJUckvbiftVLc/oB1KhpkZQv/UMDVWQPym18B0pQvc/WVOdNOYYYLbeU25W0mnAVKdVbHKGo0d+GtAPYvhRPyXTnRxQbFhaBiQunq/T2SsiWIREJhWx8yLPJDV6mPQ982G/HzZict1FQTBmOA1/VxFWlJFpSnsEIfiDXegVw2nW8XcLQBR1m/CZ4dCd9purL3F72z9jZAZEcHiD8QIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/SSMAndSwagger/api/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/api/return";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do?charset=utf-8";

    // 支付宝网关
    public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
